package ssd.web;

/**
 * Created by 刘宇飞 on 2017/5/15.
 */


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import ssd.dto.Emp;
import ssd.service.EmpService;
import java.util.List;

@Controller
public class SampleController {

    @Autowired
    private EmpService helloWorldService;

//    @GetMapping("/")
//    @ResponseBody
//    public String helloWorld() {
//
//        return this.helloWorldService.getHelloMessage();
//    }


    @GetMapping("/emps")
    @ResponseBody
    public PageInfo getEmps() {
        PageHelper.startPage(1, 2);
        List<Emp> list = this.helloWorldService.getEmps();
        PageInfo pageInfo = new PageInfo(list);
      //  Page page = (Page) list;
        long ss=pageInfo.getTotal();
        return pageInfo;
    }



}
